package com.example.common.constants;

/**
 * @Author Peng Yisheng
 * @Date 2024/12/3 14:41
 * @Description 过滤器常量类
 */
public interface FilterConst {

    // 过滤器执行顺序
    int MONITOR_FILTER_ORDER = -1;
    int GRAY_FILTER_ORDER = 0;
    int MOCK_FILTER_ORDER = 0;
    int USER_AUTH_FILTER_ORDER = 1;
    int FLOW_CTL_FILTER_ORDER = 50;
    int LOAD_BALANCE_FILTER_ORDER = 100;
    int ROUTER_FILTER_ORDER = Integer.MAX_VALUE;
    int MONITOR_END_FILTER_ORDER = Integer.MAX_VALUE;


    // 路由过滤器
    String ROUTER_FILTER_ID = "router_filter";
    String ROUTER_FILTER_NAME = "router_filter";


    // 负载均衡过滤器
    String LOAD_BALANCE_FILTER_ID = "load_balance_filter";
    String LOAD_BALANCE_FILTER_NAME = "load_balance_filter";
    String LOAD_BALANCE_KEY = "load_balance";
    String LOAD_BALANCE_STRATEGY_RANDOM = "random";
    String LOAD_BALANCE_STRATEGY_ROUND_ROBIN = "round_robin";


    // 流量控制过滤器
    String FLOW_CTL_FILTER_ID = "flow_ctl_filter";
    String FLOW_CTL_FILTER_NAME = "flow_ctl_filter";
    String FLOW_CTL_TYPE_PATH = "path";
    String FLOW_CTL_TYPE_SERVICE = "service";
    String FLOW_CTL_LIMIT_DURATION = "duration"; // 以秒为单位
    String FLOW_CTL_LIMIT_PERMITS = "permits"; // 允许请求的次数
    String FLOW_CTL_MODEL_DISTRIBUTED = "distributed"; // 分布式
    String FLOW_CTL_MODEL_SINGLETON = "singleton";  // 单机


    // 监控前置、后置过滤器
    String MONITOR_FILTER_ID = "monitor_filter";
    String MONITOR_FILTER_NAME = "monitor_filter";
    String MONITOR_END_FILTER_ID = "monitor_end_filter";
    String MONITOR_END_FILTER_NAME = "monitor_end_filter";


    // 灰度请求过滤器
    String GRAY_FILTER_ID = "gray_filter";
    String GRAY_FILTER_NAME = "gray_filter";


    // mock请求过滤器
    String MOCK_FILTER_ID = "mock_filter";
    String MOCK_FILTER_NAME = "mock_filter";


    // 用户鉴权过滤器
    String USER_AUTH_FILTER_ID = "user_auth_filter";
    String USER_AUTH_FILTER_NAME = "user_auth_filter";

}
